|
|
|
|
|
|
|
Because the length of A × B = |A| * |B| * Sin(q), this gives you a method for calculating the sine of the angle between two vectors. |
|
|
|
 |
|
|
|
|
Sin(q) = |A × B|/(|A| * |B|) |
|
|
|
|
|
|
|
|
If A and B are normalized, this simplifies to: |
|
|
|
 |
|
|
|
|
Sin(q) = |A × B| |
|
|
|
|
|
|
|
|
Note also that Sin2(q) + Cos2(q) = 1, so |
|
|
|
 |
|
|
|
|
Sin(q) = Sqr(1 - Cos2(q)) |
|
|
|
|
|
|
|
|
Cross products are useful for finding vectors perpendicular to other vectors. For example, suppose A and B are two vectors in a plane. Then A × B gives a vector perpendicular to the plane. |
|
|
|
|
|
|
|
|
For another example, suppose R is a vector from the center of a sphere to a point on the sphere. The cross product of this vector with any nonparallel vector gives a new vector A that is perpendicular to R. A is a vector in the plane tangent to the sphere at the end point of R. Now if you calculate B = A × R, you get another vector in the tangent plane that is perpendicular to A and R. The vectors A and B define the sphere's tangent plane. |
|
|
|
|
|
|
|
|
Matrix-Vector Multiplication |
|
|
|
|
|
|
|
|
Matrix-vector multiplication uses only simple addition and multiplication, but there are so many operations, it can be a little confusing. When you multiply a vector by a matrix, the result is a new vector. |
|
|
|
|
|
|
|
|
You can think of the matrix as a collection of vectors written vertically from top to bottom instead of horizontally from left to right. In that case, the components of the result vector are given by the dot products of the vector and the matrix's column vectors. For example, consider the following multiplication between vector V and matrix M. |
|
|
|
|
|
|
|
|
Written with the matrix represented by column vectors, this is: |
|
|
|
|
|
|
|
|
The first column vector in the matrix is <m11, m21, m31>. The first entry in the result is the dot product between V and this column vector or vx * m11 + vy * m21 + vz * m31. |
|
|
|
|
|